<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>基础知识</title>
	<link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.min.css"" rel="stylesheet">
	<link href="https://cdn.bootcdn.net/ajax/libs/animate.css/3.2.3/animate.css" rel="stylesheet">
    <link href="https://cdn.bootcdn.net/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
	<link rel="stylesheet" type="text/css" href="../../static/css/public.css" />
</head>
<body>
	<!-- 回到顶部 -->
	<div class="topBtn">
		<a href="#top">
			<i class="fa fa-long-arrow-up"></i>
		</a>
	</div>
	<!--右边内容-->
	<div id="app" class="main animated fadeInRight">
		<div class="shadow">
			<div class="Table" v-cloak id="top">
				<div class="TableRow" v-for="(el,index) in list">
					<a class="RowLeft" :href="'#'+el.id">{{el.name}}</a>
					<span class="RowRight">{{el.explain}}</span>
				</div>
			</div>
			<div>
				<h4 id="scrollTo">scrollTo()</h4>
				<div></div>
				<pre>
		const backTop2 = document.getElementById("backTop2")
		const TOP = document.getElementById("top")
		const y = TOP.offsetTop
		const backTop3 = document.getElementById("backTop3")
		backTop3.addEventListener("click", function (e) {
			window.scrollTo({ top: y, left: 0, behavior: 'smooth' })
		})
				</pre>
			</div>
			<div>
				<h4 id="scrollIntoView">scrollIntoView()</h4>
				<pre>
		const backTop2 = document.getElementById("backTop2")
		const TOP = document.getElementById("top")
		backTop2.addEventListener("click", function (e) {
			TOP.scrollIntoView({ behavior: "smooth" })
		})
			
				</pre>
			</div>
		</div>
	</div>
	<!--页面加载进度条-->
	<script src="https://cdn.bootcdn.net/ajax/libs/pace/0.5.0/pace.min.js"></script>
	<script src="https://cdn.bootcdn.net/ajax/libs/vue/2.5.17/vue.js" type="text/javascript" charset="utf-8"></script>
	<!--定义数据-->
	<script type="text/javascript">
		var app = new Vue({
			el: "#app",
			data: function () {
				return {
					list: [
						{ name: "scrollTo",id: "scrollTo",explain: ''},
						{ name: "scrollIntoView()",id: "scrollIntoView",explain: ''},
					]
				}
			},
		})
	</script>
</body>

</html>